Kurt Hsu's blog

The Rails developer in taiwan.


  • 首頁

  • 標籤

  • 分類

  • 歸檔

[Disqus]簡易留言板

發表於 2018-04-21 更新於 2019-08-21 分類於 Disqus

首先我們先到Disqus官方網站點選GET STARTED > I want to install Disqus on my site辦好一個網站在這個平台裡面,當詢問到What platform is your site on?時請選擇最下面的Universal Code,這時候就會看到他們提供了直接可以使用的程式碼。

P.S.這個平台容易讓人誤會的是他也是個社群平台,但我們只要他簡單的留言板功能而已

基本上只要貼上他的第一個提供的code到自己的view就行了!他連該利用這個網站的shortname去抓哪一隻js都幫忙列出了。

show.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<div id="disqus_thread"></div>
<script>

/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
/*
var disqus_config = function () {
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
*/
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://your-shortname.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
# Disqus
[Rails]Devise login with google
[Rails]image file in asset or public

Kurt Hsu

Progress One Percent Every Day
171 文章
55 分類
163 標籤
RSS
© 2020 Kurt Hsu
由 Hexo 強力驅動 v3.8.0
|
主題 – NexT.Muse v7.3.0